﻿using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Controls;
using System.Windows.Media;

namespace Notoric.ViewModel
{
    /// <summary>
    /// The interface a class must implement to be visualized in the project explorer window.
    /// </summary>
    public interface IProjectExplorerItem : INotifyPropertyChanged
    {
        /// <summary>
        /// Gets the context menu for this item.
        /// </summary>
        /// <value>
        /// <para>
        /// Type: <see cref="ContextMenu"/>
        /// </para>
        /// <para>
        /// The context menu for this item.
        /// </para>
        /// </value>
        ContextMenu ContextMenu
        {
            get;
        }

        /// <summary>
        /// Gets the string that is displayed in the project explorer for this item.
        /// </summary>
        /// <value>
        /// <para>
        /// Type: <see cref="System.String"/>
        /// </para>
        /// <para>
        /// The string representation of this item that will be displayed
        /// in the project explorer (e.g. the name of the item).
        /// </para>
        /// </value>
        string DisplayName
        {
            get;
        }

        /// <summary>
        /// Gets or sets the name of this item.
        /// </summary>
        /// <value>
        /// <para>
        /// Type: <see cref="System.String"/>
        /// </para>
        /// <para>
        /// The name of this item.
        /// </para>
        /// </value>
        string Name
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the icon that represents this project explorer item.
        /// </summary>
        /// <value>
        /// <para>
        /// Type: <see cref="ImageSource"/>
        /// </para>
        /// <para>
        /// An icon that will be displayed with this item in the project explorer.
        /// </para>
        /// </value>
        ImageSource Icon
        {
            get;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this item is currently expanded in the project explorer.
        /// </summary>
        /// <value>
        /// <para>
        /// Type: <see cref="System.Boolean"/>
        /// </para>
        /// <para>
        /// This value is intended for a two-way binding with the <see cref="TreeViewItem.IsExpanded"/> property.
        /// It indicates whether the <see cref="Children"/> (nested items) are expanded or collapsed.
        /// </para>
        /// </value>
        bool IsExpanded
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the value indicating whether this item is currently in edit mode.
        /// </summary>
        /// <value>
        /// <para>
        /// Type: <see cref="bool"/>
        /// </para>
        /// <para>
        /// Indicates whether this item is currently in edit mode (its <see cref="Name"/> can be edited)
        /// or not.
        /// </para>
        /// </value>
        bool IsInEditMode
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this item is currently selected in the project explorer.
        /// </summary>
        /// <value>
        /// <para>
        /// Type: <see cref="System.Boolean"/>
        /// </para>
        /// <para>
        /// This value is intended for a two-way binding with the <see cref="TreeViewItem.IsSelected"/> property.
        /// It indicates whether this item is currently selected or not.
        /// </para>
        /// </value>
        bool IsSelected
        {
            get;
            set;
        }

        /// <summary>
        /// Gets a reference to the parent item.
        /// </summary>
        /// <value>
        /// <para>
        /// Type: <see cref="IProjectExplorerItem"/>
        /// </para>
        /// <para>
        /// The <see cref="IProjectExplorerItem"/> that is the direct owner of this item
        /// (i.e. this item belongs to the <see cref="Parent"/>'s <see cref="Children"/> collection).
        /// </para>
        /// </value>
        IProjectExplorerItem Parent
        {
            get;
            set;
        }

        /// <summary>
        /// Gets a collection of nested items.
        /// </summary>
        /// <value>
        /// <para>
        /// Type: <see cref="ObservableCollection{T}"/> of <see cref="IProjectExplorerItem"/>
        /// </para>
        /// <para>
        /// The project explorer items that are nested in this item.
        /// </para>
        /// </value>
        ObservableCollection<IProjectExplorerItem> Children
        {
            get;
        }
    }
}
